﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;

namespace NamingOnLessonUtility
{
    public class MD5Helper
    {
        /// <summary>
        /// 返回32位MD5加密
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string GetMD5Code(string str)
        {
            string value = "";
            MD5 md5 = MD5.Create();
            byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(str));
            for (int i = 0; i < s.Length; i++)
            {
                value = value + s[i].ToString("X");
            }
            return value;
        }
    }
}
